package com.basic.socket;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;

public class TestInetSocketAddress {
    public static void main(String[] args) throws UnknownHostException {
        InetAddress ia = InetAddress.getLocalHost();
        InetSocketAddress isa = new InetSocketAddress("www.baidu.com",8888);

        System.out.println(isa);
        System.out.println(isa.getPort());
        System.out.println(isa.getAddress());
        System.out.println(isa.getAddress().getHostAddress());
        System.out.println(isa.getHostName());

    }
}
